<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>定义函数</title>
		
	</head>
	<body>
		<form name="myForm" action="">
			请输入显示次数：<input type="text" name="txtCount" value="3"/>
			<input type="button" value="显示次数" onclick="showHello()"/>
		</form>
		<script type="text/javascript">
			function showHello()
			{
				var count=document.myForm.txtCount.value;
				for(var i=0;i<count;i++)
				{
					document.write("<h2>Hello World!</h2>");
				}
			}
//			showHello();
			window.onload=showHello;
		</script>
	</body>
</html>
